package com.xiaoyy.app.extend.gateway.controller;

import com.xiaoyy.app.extend.common.vo.*;
import com.xiaoyy.app.extend.integration.ZzdIntegration;
import com.xiaoyy.core.common.vo.AppResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/other/sso/zzd")
@Api(tags = "浙政钉接口管理")
public class ZzdController {
    @Autowired
    ZzdIntegration zzdIntegration;

    @PostMapping(value = "/getAccessToken", produces = "application/json;charset=UTF-8")
    @ApiOperation(value = "获取鉴权accessToken", notes = "获取鉴权accessToken")
    public AppResponse<String> ticketValidation(@RequestBody QueryZzdTokenVO req) {
        return AppResponse.successData(zzdIntegration.getAccessToken(req));
    }

    @PostMapping(value = "/getEmployeeIdByMobile", produces = "application/json;charset=UTF-8")
    @ApiOperation(value = "根据手机号获取员工账号ID", notes = "根据手机号获取员工账号ID")
    public AppResponse<String> getUserInfo(@RequestBody ZzdEmployeeVO req) {
        return AppResponse.successData(zzdIntegration.getEmployeeIdByMobile(req));
    }
}
